﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TRConverterServer
{
    public abstract class Singleton<T> where T : class
    {

        private static volatile T _instance;

        private static readonly object _locker = new object();



        public static T Instance
        {

            get
            {

                if (_instance == null)
                {

                    lock (_locker)
                    {

                        if (_instance == null)

                            _instance = Activator.CreateInstance(typeof(T), true) as T;

                    }

                }


                return _instance;

            }

        }

    }
}
